package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtBranchServicesMapper;
import com.ruoyi.business.domain.JtBranchServices;
import com.ruoyi.business.service.IJtBranchServicesService;
import com.ruoyi.common.core.text.Convert;

/**
 * 服务网点Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-03-29
 */
@Service
public class JtBranchServicesServiceImpl implements IJtBranchServicesService 
{
    @Autowired
    private JtBranchServicesMapper jtBranchServicesMapper;

    /**
     * 查询服务网点
     * 
     * @param servicesId 服务网点主键
     * @return 服务网点
     */
    @Override
    public JtBranchServices selectJtBranchServicesByServicesId(Long servicesId)
    {
        return jtBranchServicesMapper.selectJtBranchServicesByServicesId(servicesId);
    }

    /**
     * 查询服务网点列表
     * 
     * @param jtBranchServices 服务网点
     * @return 服务网点
     */
    @Override
    public List<JtBranchServices> selectJtBranchServicesList(JtBranchServices jtBranchServices)
    {
        return jtBranchServicesMapper.selectJtBranchServicesList(jtBranchServices);
    }

    /**
     * 新增服务网点
     * 
     * @param jtBranchServices 服务网点
     * @return 结果
     */
    @Override
    public int insertJtBranchServices(JtBranchServices jtBranchServices)
    {
        jtBranchServices.setCreateBy(ShiroUtils.getSysUser().getUserName());
        jtBranchServices.setCreateTime(DateUtils.getNowDate());
        return jtBranchServicesMapper.insertJtBranchServices(jtBranchServices);
    }

    /**
     * 修改服务网点
     * 
     * @param jtBranchServices 服务网点
     * @return 结果
     */
    @Override
    public int updateJtBranchServices(JtBranchServices jtBranchServices)
    {
        jtBranchServices.setUpdateBy(ShiroUtils.getSysUser().getUserName());
        jtBranchServices.setUpdateTime(DateUtils.getNowDate());
        return jtBranchServicesMapper.updateJtBranchServices(jtBranchServices);
    }

    /**
     * 批量删除服务网点
     * 
     * @param servicesIds 需要删除的服务网点主键
     * @return 结果
     */
    @Override
    public int deleteJtBranchServicesByServicesIds(String servicesIds)
    {
        return jtBranchServicesMapper.deleteJtBranchServicesByServicesIds(Convert.toStrArray(servicesIds));
    }

    /**
     * 删除服务网点信息
     * 
     * @param servicesId 服务网点主键
     * @return 结果
     */
    @Override
    public int deleteJtBranchServicesByServicesId(Long servicesId)
    {
        return jtBranchServicesMapper.deleteJtBranchServicesByServicesId(servicesId);
    }
}
